home *** CD-ROM | disk | FTP | other *** search
/ HamCall (April 1991) / HAMCALL CD-ROM (Buckmaster)(April 1991).BIN / prgming / ctutor / betterin.c < prev    next >
Text File  |  1990-10-14  |  759b  |  33 lines

  1.                                         /* Chapter 9 - Program 3 */
  2. #include "stdio.h"
  3. #define CR 13       /* this defines CR to be 13 */
  4. #define LF 10       /* this defines LF to be 10 */
  5.  
  6. main()
  7. {
  8. char c;
  9.  
  10.    printf("Input any characters, hit X to stop.\n");
  11.  
  12.    do {
  13.       c = getch();                    /* get a character */
  14.       putchar(c);                     /* display the hit key */
  15.       if (c == CR) putchar(LF);       /* if it is a carriage return
  16.                                          put out a linefeed too */
  17.    } while (c != 'X');
  18.  
  19.    printf("\nEnd of program.\n");
  20. }
  21.  
  22.  
  23.  
  24. /* Result of execution
  25.  
  26. Input any characters, hit X to stop.
  27.  
  28. (The output depends on what characters you enter.)
  29.  
  30. End of program.
  31.  
  32. */
  33.